package com.xywy.tangandroid.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.xywy.tangandroid.R;
import com.xywy.tangandroid.base.BaseActivity;
import com.xywy.tangandroid.me.activity.SetAboutSugarDoctorFeedBackActivity;

public class AboutAct extends BaseActivity {
	private RelativeLayout left_img;
	private TextView middle_title;
	private RelativeLayout feedback;
	private RelativeLayout version_update;
	private RelativeLayout rl_mine_set_aboutsugardoctor_go_grade;

	@Override
	protected void initView(Bundle savedInstanceState) {
		setContentView(R.layout.act_about);
		left_img = (RelativeLayout) findViewById(R.id.left_img);
		middle_title = (TextView) findViewById(R.id.middle_title);
		middle_title.setText(getResources().getString(
				R.string.mine_set_about_sugardoctor));
		rl_mine_set_aboutsugardoctor_go_grade = (RelativeLayout) findViewById(R.id.rl_mine_set_aboutsugardoctor_go_grade);
		feedback = (RelativeLayout) findViewById(R.id.feedback);
		version_update = (RelativeLayout) findViewById(R.id.version_update);
	}

	@Override
	protected void initListener() {
		left_img.setOnClickListener(this);
		rl_mine_set_aboutsugardoctor_go_grade.setOnClickListener(this);
		feedback.setOnClickListener(this);
		version_update.setOnClickListener(this);
	}

	@Override
	protected void initData() {

	}

	@Override
	public void onClick(View v) {
		super.onClick(v);
		switch (v.getId()) {
		case R.id.left_img:
			finish();
			break;
		case R.id.rl_mine_set_aboutsugardoctor_go_grade:
			clickPingfen();
			break;
		case R.id.feedback:
			Intent feddbackIntent = new Intent(this,
					SetAboutSugarDoctorFeedBackActivity.class);
			startActivity(feddbackIntent);

			break;
		case R.id.version_update:
			Toast.makeText(context, "已是最新版本", Toast.LENGTH_SHORT).show();
			break;
		default:
			break;
		}
	}

	private void clickPingfen() {
		Uri uri = Uri.parse("market://details?id=" + getPackageName());
		Intent intent = new Intent(Intent.ACTION_VIEW, uri);
		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		startActivity(intent);
	}
}
